package com.chalk.service.impl;


import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.chalk.dao.FeedbackDao;
import com.chalk.model.Feedback;
import com.chalk.model.Member;
import com.chalk.service.FeedbackService;

import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author glq
 * @since 2020-12-31
 */

@Service
public class FeedbackServiceImpl extends ServiceImpl<FeedbackDao, Feedback> implements FeedbackService {

    @Override
    public int addFeedback(Feedback entity) {
        return baseMapper.insert(entity);
    }

    @Override
    public int updateFeedback(Feedback entity) {
        return baseMapper.updateById(entity);
    }


    @Override
    public int deleteFeedback(Integer id) {
        return baseMapper.deleteById(id);
    }

    @Override
    public Boolean submitFeedback(Feedback feedback, Member member) {
        feedback.setCreateTime(LocalDateTime.now());
        feedback.setMemberId(member.getMemberId());
        return insert(feedback);
    }
}
